{{- $redirectURL := "" }}
{{ with .Params.redirect}}
  {{ if or (hasPrefix . "http:") (hasPrefix . "https:") }}
    {{ $redirectURL = . }}
  {{ else }}
    {{ $redirectURL = ref $ .}}
  {{ end }}
{{ end }}
<!DOCTYPE html>
<html>
  <head>
    <title>{{ block "title" . }}{{ end }}</title>
    {{ partial "html-head.html" . }}
    {{if ne $redirectURL "" }}
      <meta http-equiv="refresh" content="0;{{ $redirectURL }}">
    {{end}}
  </head>

  <body data-url="{{ .RelPermalink }}"

  class="
  {{- with .Params.render}}render_{{.}} {{end -}}
  {{if (in .Params.hide "header")}}hideheader {{end -}}
  {{if (in .Params.hide "nav")}}hidenav {{end -}}
  {{if (in .Params.hide "breadcrumb")}}hidebreadcrumb {{end -}}
  {{if (in .Params.hide "toc")}}hidetoc {{end -}}
  {{if (in .Params.hide "footer")}}hidefooter {{end -}}
  {{if (in .Params.hide "nextpage")}}hidenextpage {{end -}}
  ">

<style type="text/css">
  #debug{
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    line-height: 3.5rem;
    margin-bottom: .35rem;
    padding: 0 2rem;
    position: fixed;
    left: 0;      right: 0;     top: 0;
   
    top:0px;
    
    min-height: 150px;

    background-color: white;
    border: 3px solid red;
    z-index: 10000 ;
    word-wrap: all;
    overflow: auto;
  }
</style>
 <!-- 
 <pre id="debug">
  {{ printf "%#v" .Params.hide }}
  {{ printf "%#v" (in .Params.hide "breadcrumb") }}
</pre> 
  -->

{{ if ne $redirectURL ""}}
    <script type="text/javascript">
      window.location = '{{ $redirectURL }}'
    </script>
    <a href="{{ $redirectURL }}">go to {{ $redirectURL }}</a>
{{ else if eq .Params.render "raw" }}
      {{- .Content -}}
{{ else }}
    
    {{if not (in .Params.hide "header")}}
    <header style="">
        {{ partial "body-header.html" . }}
    </header>
    {{end}}

    <article>
      {{if not (in .Params.hide "nav")}}
      <aside class="{{.Params.layout }}">
        {{ partial "body-sidebar.html" . }}
      </aside>
      {{end}}

      <section class="page {{.Params.layout }}">
      {{ block "main" . }}
      {{ end }}
      </section>

      <!-- NAVIGATION DROITE TOC -->
      {{if not (in .Params.hide "toc")}}
      <section class="right-menu {{.Params.layout }}">
      {{ block "sidepage" . }}
      {{ end }}
      </section>
      {{end -}}
      <!-- FIN NAVIGATION DROITE TOC -->
    </article>
    
    {{if not (in .Params.hide "footer")}}
    <footer>
      {{ partial "body-footer.html" . }}
    </footer>
    {{end}}

{{end}}

  </body>
</html>
